<?php
include_once("db.inc.php");
$newPassword=md5(trim(admin));
$result=mysql_query("SELECT ui_password FROM users");
if (!$result) {

	$addField=mysql_query("ALTER TABLE  `users` ADD  `ui_password` VARCHAR( 50 ) NOT NULL") OR die(mysql_error());
	$addUser=mysql_query("INSERT INTO users (email, ui_password) VALUES ('root@localhost', '$newPassword')");
	if($addUser)
	{
		echo "
			<h2>The system was successfully installed</h2>
			<h3>You can login into system now with username root@localhost and password admin</h3>
			<a href='index.php'>Login now!</a>
		";
	}
    exit;
}
else
{
echo "
<h2>The database does not need to be updated!</h2>
Contact the sysadmin to obtain information about 
users table (mail database).<br>
Change the field <b><i>users.ui_password</b></i> field to user who will administer the system.<br>
If you know user and password, please                         <a href='index.php'>Login now!</a>

";

}
?>
